import unittest, datetime
from hurryoff.services.parsers import jsonDumpObject, getTimeDelta
from hurryoff.core.router import PathPart

class ParesersTests(unittest.TestCase):

    def test_dumpObjectToJSON(self):
        json = jsonDumpObject(PathPart("start", "end", datetime.time(20, 9), datetime.time(21, 11), 1))
        self.assertIsNotNone(json)

    def test_getTimeDelta(self):
        self.assertEqual("1h 2m", getTimeDelta(datetime.time(20, 9), datetime.time(21, 11)))